import javax.swing.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeDisplay {
    public static void main(String[] args) {
        JFrame frame = new JFrame("Time Display");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 200);

        JLabel timeLabel = new JLabel();
        timeLabel.setHorizontalAlignment(JLabel.CENTER);
        frame.getContentPane().add(timeLabel);

        frame.setVisible(true);

        new Thread(() -> {
            SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
            while (true) {
                String time = formatter.format(new Date());
                timeLabel.setText(time);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }
}